{% extends "two_column_body.html" %}
<!-- create_ask_widget.html -->
{% block title %}{{ widget_name|capitalize }} widget list{% endblock %}
{% block content %}
<h1>{% trans type=widget_name|capitalize %}{{ type }} widget list{% endtrans %}</h1>
<table>
    <tr>
        <th>{% trans %}Widget Title{% endtrans %}</th>
        <th>{% trans %}Code{% endtrans %}</th>
        <th>{% trans %}Actions{% endtrans %}</th>
    </tr>
    {% if request.is_secure() %}
        {% set protocol='https' %}
    {% else %}
        {% set protocol='http' %}
    {% endif %}
    {% if widget_name == 'ask' %}
        {% for widget in widgets %}
        <tr>
            <td>{{ widget.title }}</td>
            <td>&lt;script type="text/javascript" src="{{ protocol }}://{{ request.get_host() }}{% url render_ask_widget widget.id %}" &gt;&lt;/script&gt;</td> 
            <td>
                <a href="{% url edit_widget widget_name, widget.id %}">{% trans %}Edit{% endtrans %}</a> | 
                <a href="{% url delete_widget widget_name, widget.id %}">{% trans %}Delete{% endtrans %}</a>
            </td>
        </tr>
        {% endfor %}
    {% else %}
        {% for widget in widgets %}
        <tr>
            <td>{{ widget.title }}</td>
            <td> &lt;iframe src="{{ protocol }}://{{ request.get_host() }}{% url question_widget widget.id %}" &gt; &lt;/iframe&gt;</td> 
            <td>
                <a href="{% url edit_widget widget_name, widget.id %}">{% trans %}Edit{% endtrans %}</a> |
                <a href="{% url delete_widget widget_name, widget.id %}">{% trans %}Delete{% endtrans %}</a>
            </td>
        </tr>
        {% endfor %}
    {% endif %}
</table>
{% endblock %}

{% block endjs %}
{% endblock %}

{% block sidebar %}
<div class="box">
    <h2>{% trans %}How to use?{% endtrans %}</h2>
    <p>
        {% trans %}Just copy the &lt;script&gt; tag provided and paste it in the site where you wan to put it.{% endtrans %} 
    </p>
</div>
{% endblock %}
